package com.example.delivery.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.delivery.pojo.Restaurant;
import com.example.delivery.service.RestaurantService;
import com.example.delivery.mapper.RestaurantMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author huber
* @description 针对表【restaurant】的数据库操作Service实现
* @createDate 2025-03-18 13:29:36
*/
@Service
public class RestaurantServiceImpl extends ServiceImpl<RestaurantMapper, Restaurant>
    implements RestaurantService{

    @Autowired
    private RestaurantMapper restaurantMapper;
    @Override
    public List<Restaurant> findAll() {
        List<Restaurant> restaurants = restaurantMapper.selectList(null);
        return restaurants;
    }

    @Override
    public List<Restaurant> findByName(String name) {
        QueryWrapper<Restaurant> queryWrapper = new QueryWrapper();
        queryWrapper.like("name",name);
        return restaurantMapper.selectList(queryWrapper);
    }

    @Override
    public Restaurant findById(Integer id) {
        return restaurantMapper.findById(id);
    }
}




